install.packages(c("tidyverse", "fixest"))
library(tidyverse)
library(fixest)

## Loading data
load("pres_voting_dta.RData")
load("gov_voting_dta.RData")
load("ndeal.RData")
load("pres.RData")
load("census1930.RData")

## FIGURE 2 ##
dta = ndeal %>%
  left_join(., pres, by = "my_fips") %>%
  group_by(state) %>%
  mutate(wpa_quintile = ntile(pc_wpa, 5),
         pwa_quintile = ntile(pc_pwa, 5))

# Panel A
wpa_descriptives = dta %>%
  group_by(year, wpa_quintile) %>%
  summarise(avg_pct_dem_pres = mean(pct_dem_pres, na.rm = TRUE)) %>%
  filter(!is.na(year)) %>%
  ggplot(aes(x = factor(year), y = avg_pct_dem_pres, group = factor(wpa_quintile), color = factor(wpa_quintile))) +
  geom_line(size = 0.5) +
  geom_point() +
  theme_bw() +
  labs(x = "Election",
       y = "Average % Democrat",
       color = "WPA Quintile") +
  scale_color_manual(values = c("#fee5d9", "#fcae91", "#fb6a4a", "#de2d26", "#a50f15")) +
  geom_vline(xintercept="1936", linetype="dashed", color = "darkgray") +
  theme(legend.position = "bottom",
        legend.margin = margin(t = -0.3, r = 0, b = 0, l = 0, unit = "cm"),
        panel.grid.major = element_blank(), 
        panel.grid.minor = element_blank(),
        panel.background = element_rect(colour = "black"),
        axis.text.x = element_text(angle = 45, hjust = 1))

# Panel B
pwa_descriptives = dta %>%
  group_by(year, pwa_quintile) %>%
  summarise(avg_pct_dem_pres = mean(pct_dem_pres, na.rm = TRUE)) %>%
  filter(!is.na(year)) %>%
  ggplot(aes(x = factor(year), y = avg_pct_dem_pres, group = factor(pwa_quintile), color = factor(pwa_quintile))) +
  geom_line(size = 0.5) +
  geom_point() +
  theme_bw() +
  labs(x = "Election",
       y = "Average % Democrat",
       color = "PWA Quintile") +
  scale_color_manual(values = c("#fee5d9", "#fcae91", "#fb6a4a", "#de2d26", "#a50f15")) +
  geom_vline(xintercept="1936", linetype="dashed", color = "darkgray") +
  theme(legend.position = "bottom",
        legend.margin = margin(t = -0.3, r = 0, b = 0, l = 0, unit = "cm"),
        panel.grid.major = element_blank(), 
        panel.grid.minor = element_blank(),
        panel.background = element_rect(colour = "black"),
        axis.text.x = element_text(angle = 45, hjust = 1))


## TABLE 1 ##
# Column 1
summary(wpa_nocontrol_1916_1944 <- feols(pct_dem_pres ~  I(log(pc_wpa + 1)) | 
                                           my_fips + state^year,
                                         data = pres_voting_dta))
# Column 2
summary(wpa_1916_1944 <- feols(pct_dem_pres ~  I(log(pc_wpa + 1)) | 
                                 my_fips + state^year + urban_quintile^state^year + 
                                 black_quintile^state^year + foreign_quintile^state^year + 
                                 unemp_quintile^state^year,
                               data = pres_voting_dta))
# Column 3
summary(pwa_nocontrol_1916_1944 <- feols(pct_dem_pres ~  I(log(pc_pwa + 1)) | 
                                           my_fips + state^year,
                                         data = pres_voting_dta))
# Column 4
summary(pwa_1916_1944 <- feols(pct_dem_pres ~  I(log(pc_pwa + 1)) | 
                                 my_fips + state^year + urban_quintile^state^year + 
                                 black_quintile^state^year + foreign_quintile^state^year + 
                                 unemp_quintile^state^year,
                               data = pres_voting_dta))
# Column 5
summary(pwa_labor_nocontrol_1916_1944 <- feols(pct_dem_pres ~  I(log(pc_pwa_site_labor + 1)) | 
                                                 my_fips + state^year,
                                               data = pres_voting_dta))
# Column 6
summary(pwa_labor_1916_1944 <- feols(pct_dem_pres ~  I(log(pc_pwa_site_labor + 1)) | 
                                       my_fips + state^year + urban_quintile^state^year + 
                                       black_quintile^state^year + foreign_quintile^state^year + 
                                       unemp_quintile^state^year,
                                     data = pres_voting_dta))
# Column 7
summary(wpa_nocontrol_1932_1944 <- feols(pct_dem_pres ~  I(log(pc_wpa + 1)) | 
                                           my_fips + state^year,
                                         data = pres_voting_dta %>% filter(year >= 1932)))
# Column 8
summary(wpa_1932_1944 <- feols(pct_dem_pres ~  I(log(pc_wpa + 1)) | 
                                 my_fips + state^year + urban_quintile^state^year + 
                                 black_quintile^state^year + foreign_quintile^state^year + 
                                 unemp_quintile^state^year,
                               data = pres_voting_dta %>% filter(year >= 1932)))
# Column 9
summary(pwa_nocontrol_1932_1944 <- feols(pct_dem_pres ~  I(log(pc_pwa + 1)) | 
                                           my_fips + state^year,
                                         data = pres_voting_dta %>% filter(year >= 1932)))
# Column 10
summary(pwa_1932_1944 <- feols(pct_dem_pres ~  I(log(pc_pwa + 1)) | 
                                 my_fips + state^year + urban_quintile^state^year + 
                                 black_quintile^state^year + foreign_quintile^state^year + 
                                 unemp_quintile^state^year,
                               data = pres_voting_dta %>% filter(year >= 1932)))
# Column 11
summary(pwa_labor_nocontrol_1932_1944 <- feols(pct_dem_pres ~  I(log(pc_pwa_site_labor + 1)) | 
                                                 my_fips + state^year,
                                               data = pres_voting_dta %>% filter(year >= 1932)))
# Column 12
summary(pwa_labor_1932_1944 <- feols(pct_dem_pres ~  I(log(pc_pwa_site_labor + 1)) | 
                                       my_fips + state^year + urban_quintile^state^year + 
                                       black_quintile^state^year + foreign_quintile^state^year + 
                                       unemp_quintile^state^year,
                                     data = pres_voting_dta %>% filter(year >= 1932)))

## FIGURE 3 ##
## Panel A
## Model results in Table A3 of the Dataverse appendix 
summary(wpa_lead <- feols(pct_dem_pres ~  i(year, I(log(pc_wpa_lead + 1))) | 
                            my_fips + state^year + urban_quintile^state^year + 
                            black_quintile^state^year + foreign_quintile^state^year + 
                            unemp_quintile^state^year,
                          data = pres_voting_dta))
year = seq(1920, 1944, by = 4)
wpa_lead_coef = wpa_lead$coefficients[1:7]
names(wpa_lead_coef) = NULL
wpa_lead_se = c(0.270441, 0.320978, 0.501007, 0.324638, 0.305370, 0.328096,
                0.359574)
wpa_lead = data.frame(wpa_lead_coef, wpa_lead_se, year) %>%
  mutate(post = case_when(year %in% c(1936, 1940, 1944) ~ "Post-Spending",
                          TRUE ~ "Pre-Spending"))

wpa_lead_plot = wpa_lead %>%
  ggplot(aes(x = factor(year), y = wpa_lead_coef, group = post, color = post)) +
  geom_point(position = position_dodge(width = 0.5)) +
  geom_pointrange(aes(ymin = wpa_lead_coef - (wpa_lead_se * 1.96), 
                      ymax = wpa_lead_coef + (wpa_lead_se * 1.96)), 
                  position = position_dodge(width = 0.5)) +
  geom_hline(yintercept = 0, color = "red", linetype = "dashed") +
  scale_color_manual(values = c("blue", "black")) +
  labs(x = "Election",
       y = "Effect of ln(WPA) on % Democrat") +
  theme_bw() +
  theme(legend.position = "bottom",
        legend.title = element_blank(),
        legend.margin = margin(t = -0.3, r = 0, b = 0, l = 0, unit = "cm"),
        panel.grid.major = element_blank(), 
        panel.grid.minor = element_blank(),
        panel.background = element_rect(colour = "black"))
# Panel B
summary(pwa_lead <- feols(pct_dem_pres ~  i(year, I(log(pc_pwa_lead + 1))) | 
                            my_fips + state^year + urban_quintile^state^year + 
                            black_quintile^state^year + foreign_quintile^state^year + 
                            unemp_quintile^state^year,
                          data = pres_voting_dta))
year = seq(1920, 1944, by = 4)
pwa_lead_coef = pwa_lead$coefficients[1:7]
names(pwa_lead_coef) = NULL
pwa_lead_se = c(0.142339, 0.165360, 0.254421, 0.174782, 0.176903,
                0.177294, 0.196084)
pwa_lead = data.frame(pwa_lead_coef, pwa_lead_se, year) %>%
  mutate(post = case_when(year %in% c(1936, 1940, 1944) ~ "Post-Spending",
                          TRUE ~ "Pre-Spending"))

pwa_lead_plot = pwa_lead %>%
  ggplot(aes(x = factor(year), y = pwa_lead_coef, group = post, color = post)) +
  geom_point(position = position_dodge(width = 0.5)) +
  geom_pointrange(aes(ymin = pwa_lead_coef - (pwa_lead_se * 1.96), 
                      ymax = pwa_lead_coef + (pwa_lead_se * 1.96)), 
                  position = position_dodge(width = 0.5)) +
  geom_hline(yintercept = 0, color = "red", linetype = "dashed") +
  scale_color_manual(values = c("blue", "black")) +
  labs(x = "Election",
       y = "Effect of ln(PWA) on % Democrat") +
  theme_bw() +
  theme(legend.position = "bottom",
        legend.title = element_blank(),
        legend.margin = margin(t = -0.3, r = 0, b = 0, l = 0, unit = "cm"),
        panel.grid.major = element_blank(), 
        panel.grid.minor = element_blank(),
        panel.background = element_rect(colour = "black"))

## TABLE 2 ##
# Column 1
summary(wpa_schools_1916_1944 <- feols(pct_dem_pres ~  I(log(pc_wpa_school + 1))  | 
                                         my_fips + state^year + urban_quintile^state^year + 
                                         black_quintile^state^year + foreign_quintile^state^year + 
                                         unemp_quintile^state^year,
                                       data = pres_voting_dta))
# Column 2
summary(pwa_schools_1916_1944 <- feols(pct_dem_pres ~  I(log(pc_pwa_school + 1))  | 
                                         my_fips + state^year + urban_quintile^state^year + 
                                         black_quintile^state^year + foreign_quintile^state^year + 
                                         unemp_quintile^state^year,
                                       data = pres_voting_dta))
# Column 3
summary(pwa_schools_labor_1916_1944 <- feols(pct_dem_pres ~  I(log(pc_pwa_school_site_labor + 1))  | 
                                               my_fips + state^year + urban_quintile^state^year + 
                                               black_quintile^state^year + foreign_quintile^state^year + 
                                               unemp_quintile^state^year,
                                             data = pres_voting_dta))
# Column 4
summary(wpa_schools_1932_1944 <- feols(pct_dem_pres ~  I(log(pc_wpa_school + 1))  | 
                                         my_fips + state^year + urban_quintile^state^year + 
                                         black_quintile^state^year + foreign_quintile^state^year + 
                                         unemp_quintile^state^year,
                                       data = pres_voting_dta %>% filter(year>= 1932)))
# Column 5
summary(pwa_schools_1932_1944 <- feols(pct_dem_pres ~  I(log(pc_pwa_school + 1))  | 
                                         my_fips + state^year + urban_quintile^state^year + 
                                         black_quintile^state^year + foreign_quintile^state^year + 
                                         unemp_quintile^state^year,
                                       data = pres_voting_dta %>% filter(year>= 1932)))
# Column 6
summary(pwa_schools_labor_1932_1944 <- feols(pct_dem_pres ~  I(log(pc_pwa_school_site_labor + 1))  | 
                                               my_fips + state^year + urban_quintile^state^year + 
                                               black_quintile^state^year + foreign_quintile^state^year + 
                                               unemp_quintile^state^year,
                                             data = pres_voting_dta %>% filter(year >= 1932)))

## TABLE A2 ##
# Column 1
summary(wpa_south_1916_1944 <- feols(pct_dem_pres ~  I(log(pc_wpa + 1)) + I(log(pc_wpa + 1)):south | 
                                       my_fips + state^year + urban_quintile^state^year + 
                                       black_quintile^state^year + foreign_quintile^state^year + 
                                       unemp_quintile^state^year,
                                     data = pres_voting_dta))
# Column 2
summary(pwa_south_1916_1944 <- feols(pct_dem_pres ~  I(log(pc_pwa + 1)) + I(log(pc_pwa + 1)):south | 
                                       my_fips + state^year + urban_quintile^state^year + 
                                       black_quintile^state^year + foreign_quintile^state^year + 
                                       unemp_quintile^state^year,
                                     data = pres_voting_dta))
# Column 3
summary(pwa_labor_south_1916_1944 <- feols(pct_dem_pres ~  I(log(pc_pwa_site_labor + 1)) + I(log(pc_pwa_site_labor + 1)):south | 
                                             my_fips + state^year + urban_quintile^state^year + 
                                             black_quintile^state^year + foreign_quintile^state^year + 
                                             unemp_quintile^state^year,
                                           data = pres_voting_dta))
# Column 4
summary(wpa_south_1932_1944 <- feols(pct_dem_pres ~  I(log(pc_wpa + 1)) + I(log(pc_wpa + 1)):south | 
                                       my_fips + state^year + urban_quintile^state^year + 
                                       black_quintile^state^year + foreign_quintile^state^year + 
                                       unemp_quintile^state^year,
                                     data = pres_voting_dta %>% filter(year >= 1932)))
# Column 5
summary(pwa_south_1932_1944 <- feols(pct_dem_pres ~  I(log(pc_pwa + 1)) + I(log(pc_pwa + 1)):south | 
                                       my_fips + state^year + urban_quintile^state^year + 
                                       black_quintile^state^year + foreign_quintile^state^year + 
                                       unemp_quintile^state^year,
                                     data = pres_voting_dta %>% filter(year >= 1932)))
# Column 6
summary(pwa_labor_south_1932_1944 <- feols(pct_dem_pres ~  I(log(pc_pwa_site_labor + 1)) + I(log(pc_pwa_site_labor + 1)):south | 
                                             my_fips + state^year + urban_quintile^state^year + 
                                             black_quintile^state^year + foreign_quintile^state^year + 
                                             unemp_quintile^state^year,
                                           data = pres_voting_dta %>% filter(year >= 1932)))

## TABLE A3 ##
# Column 1
summary(wpa_avg_1916_1944 <- feols(pct_dem_pres ~  above_avg_wpa | 
                                     my_fips + state^year + urban_quintile^state^year + 
                                     black_quintile^state^year + foreign_quintile^state^year + 
                                     unemp_quintile^state^year,
                                   data = pres_voting_dta))
# Column 2
summary(pwa_avg_1916_1944 <- feols(pct_dem_pres ~  above_avg_pwa | 
                                     my_fips + state^year + urban_quintile^state^year + 
                                     black_quintile^state^year + foreign_quintile^state^year + 
                                     unemp_quintile^state^year,
                                   data = pres_voting_dta))
# Column 3
summary(wpa_avg_1932_1944 <- feols(pct_dem_pres ~  above_avg_wpa | 
                                     my_fips + state^year + urban_quintile^state^year + 
                                     black_quintile^state^year + foreign_quintile^state^year + 
                                     unemp_quintile^state^year,
                                   data = pres_voting_dta %>% filter(year >= 1932)))
# Column 4
summary(pwa_avg_1932_1944 <- feols(pct_dem_pres ~  above_avg_pwa | 
                                     my_fips + state^year + urban_quintile^state^year + 
                                     black_quintile^state^year + foreign_quintile^state^year + 
                                     unemp_quintile^state^year,
                                   data = pres_voting_dta %>% filter(year >= 1932)))

## TABLE A4 ##
# Column 1
summary(wpa_binary_1916_1944 <- feols(pct_dem_pres ~  factor(wpa_quintile)*post | 
                                        my_fips + state^year + urban_quintile^state^year + 
                                        black_quintile^state^year + foreign_quintile^state^year + 
                                        unemp_quintile^state^year,
                                      data = pres_voting_dta))
# Column 2
summary(pwa_binary_1916_1944 <- feols(pct_dem_pres ~  factor(pwa_quintile)*post | 
                                        my_fips + state^year + urban_quintile^state^year + 
                                        black_quintile^state^year + foreign_quintile^state^year + 
                                        unemp_quintile^state^year,
                                      data = pres_voting_dta))
# Column 3
summary(wpa_binary_1932_1944 <- feols(pct_dem_pres ~  factor(wpa_quintile)*post | 
                                        my_fips + state^year + urban_quintile^state^year + 
                                        black_quintile^state^year + foreign_quintile^state^year + 
                                        unemp_quintile^state^year,
                                      data = pres_voting_dta %>% filter(year >= 1932)))
# Column 4
summary(pwa_binary_1932_1944 <- feols(pct_dem_pres ~  factor(pwa_quintile)*post | 
                                        my_fips + state^year + urban_quintile^state^year + 
                                        black_quintile^state^year + foreign_quintile^state^year + 
                                        unemp_quintile^state^year,
                                      data = pres_voting_dta %>% filter(year >= 1932)))

## TABLE A5 ##
# Column 1
summary(wpa_num_1916_1944 <- feols(pct_dem_pres ~  I(log(wpa_num + 1)) | 
                                     my_fips + state^year + urban_quintile^state^year + 
                                     black_quintile^state^year + foreign_quintile^state^year + 
                                     unemp_quintile^state^year,
                                   data = pres_voting_dta))
# Column 2
summary(pwa_num_1916_1944 <- feols(pct_dem_pres ~  I(log(pwa_num + 1)) | 
                                     my_fips + state^year + urban_quintile^state^year + 
                                     black_quintile^state^year + foreign_quintile^state^year + 
                                     unemp_quintile^state^year,
                                   data = pres_voting_dta))
# Column 3
summary(wpa_num_1932_1944 <- feols(pct_dem_pres ~  I(log(wpa_num + 1)) | 
                                     my_fips + state^year + urban_quintile^state^year + 
                                     black_quintile^state^year + foreign_quintile^state^year + 
                                     unemp_quintile^state^year,
                                   data = pres_voting_dta %>% filter(year >= 1932)))
# Column 4
summary(pwa_num_1932_1944 <- feols(pct_dem_pres ~  I(log(pwa_num + 1)) | 
                                     my_fips + state^year + urban_quintile^state^year + 
                                     black_quintile^state^year + foreign_quintile^state^year + 
                                     unemp_quintile^state^year,
                                   data = pres_voting_dta %>% filter(year >= 1932)))

## TABLE A6 ##
# Column 1
summary(wpa_urban_1916_1944 <- feols(pct_dem_pres ~  I(log(pc_wpa + 1))*pct_urban | 
                                       my_fips + state^year,
                                     data = pres_voting_dta))
# Column 2
summary(pwa_urban_1916_1944 <- feols(pct_dem_pres ~  I(log(pc_pwa + 1))*pct_urban | 
                                       my_fips + state^year,
                                     data = pres_voting_dta))
# Column 3
summary(wpa_urban_1932_1944 <- feols(pct_dem_pres ~  I(log(pc_wpa + 1))*pct_urban | 
                                       my_fips + state^year,
                                     data = pres_voting_dta %>% filter(year>= 1932)))
# Column 4
summary(pwa_urban_1932_1944 <- feols(pct_dem_pres ~  I(log(pc_pwa + 1))*pct_urban | 
                                       my_fips + state^year,
                                     data = pres_voting_dta %>% filter(year>= 1932)))

## TABLE A7 ##
# Column 1
summary(wpa_unemp_1916_1944 <- feols(pct_dem_pres ~  I(log(pc_wpa + 1))*pct_unemp | 
                                       my_fips + state^year,
                                     data = pres_voting_dta))
# Column 2
summary(pwa_unemp_1916_1944 <- feols(pct_dem_pres ~  I(log(pc_pwa + 1))*pct_unemp | 
                                       my_fips + state^year,
                                     data = pres_voting_dta))
# Column 3
summary(wpa_unemp_1932_1944 <- feols(pct_dem_pres ~  I(log(pc_wpa + 1))*pct_unemp | 
                                       my_fips + state^year,
                                     data = pres_voting_dta %>% filter(year>= 1932)))
# Column 4
summary(pwa_unemp_1932_1944 <- feols(pct_dem_pres ~  I(log(pc_pwa + 1))*pct_unemp | 
                                       my_fips + state^year,
                                     data = pres_voting_dta %>% filter(year>= 1932)))

## TABLE A8 ##
# Column 1
summary(wpa_foreign_1916_1944 <- feols(pct_dem_pres ~  I(log(pc_wpa + 1))*pct_foreign | 
                                         my_fips + state^year,
                                       data = pres_voting_dta))
# Column 2
summary(pwa_foreign_1916_1944 <- feols(pct_dem_pres ~  I(log(pc_pwa + 1))*pct_foreign | 
                                         my_fips + state^year,
                                       data = pres_voting_dta))
# Column 3
summary(wpa_foreign_1932_1944 <- feols(pct_dem_pres ~  I(log(pc_wpa + 1))*pct_foreign | 
                                         my_fips + state^year,
                                       data = pres_voting_dta %>% filter(year>= 1932)))
# Column 4
summary(pwa_foreign_1932_1944 <- feols(pct_dem_pres ~  I(log(pc_pwa + 1))*pct_foreign | 
                                         my_fips + state^year,
                                       data = pres_voting_dta %>% filter(year>= 1932)))

## TABLE A9 ##
# Column 1
summary(wpa_black_1916_1944 <- feols(pct_dem_pres ~  I(log(pc_wpa + 1))*pct_black | 
                                       my_fips + state^year,
                                     data = pres_voting_dta))
# Column 2
summary(pwa_black_1916_1944 <- feols(pct_dem_pres ~  I(log(pc_pwa + 1))*pct_black | 
                                       my_fips + state^year,
                                     data = pres_voting_dta))
# Column 3
summary(wpa_black_1932_1944 <- feols(pct_dem_pres ~  I(log(pc_wpa + 1))*pct_black | 
                                       my_fips + state^year,
                                     data = pres_voting_dta %>% filter(year>= 1932)))
# Column 4
summary(pwa_black_1932_1944 <- feols(pct_dem_pres ~  I(log(pc_pwa + 1))*pct_black | 
                                       my_fips + state^year,
                                     data = pres_voting_dta %>% filter(year>= 1932)))

## TABLE A10 ##
# Column 1
summary(wpa_disapproved_1916_1944 <- feols(pct_dem_pres ~  I(log(pc_wpa_disapproved + 1)) | 
                                             my_fips + state^year + urban_quintile^state^year + 
                                             black_quintile^state^year + foreign_quintile^state^year + 
                                             unemp_quintile^state^year,
                                           data = pres_voting_dta))
# Column 3
summary(wpa_disapproved_1932_1944 <- feols(pct_dem_pres ~  I(log(pc_wpa_disapproved + 1)) | 
                                             my_fips + state^year + urban_quintile^state^year + 
                                             black_quintile^state^year + foreign_quintile^state^year + 
                                             unemp_quintile^state^year,
                                           data = pres_voting_dta %>% filter(year >= 1932)))

## TABLE A11 ##
# Column 1
summary(wpa_ballots_1916_1944 <- feols(I(log(tot_votes_pres)) ~  I(log(pc_wpa + 1)) | 
                                         my_fips + state^year + urban_quintile^state^year + 
                                         black_quintile^state^year + foreign_quintile^state^year + 
                                         unemp_quintile^state^year,
                                       data = pres_voting_dta))
# Column 2
summary(wpa_ballots_1932_1944 <- feols(I(log(tot_votes_pres)) ~  I(log(pc_wpa + 1)) | 
                                         my_fips + state^year + urban_quintile^state^year + 
                                         black_quintile^state^year + foreign_quintile^state^year + 
                                         unemp_quintile^state^year,
                                       data = pres_voting_dta %>% filter(year>=1932)))

## TABLE A12 ##
# Column 1
summary(wpa_gov <- feols(pct_dem_gov ~  I(log(pc_wpa + 1)) | 
                           my_fips + state^year + urban_quintile^state^year + 
                           black_quintile^state^year + foreign_quintile^state^year + 
                           unemp_quintile^state^year,
                         data = gov_voting_dta))
# Column 2
summary(wpa_gov_incumbent <- feols(pct_dem_gov ~  I(log(pc_wpa + 1)) + I(log(pc_wpa + 1)):gop_seat | 
                                     my_fips + state^year + urban_quintile^state^year + 
                                     black_quintile^state^year + foreign_quintile^state^year + 
                                     unemp_quintile^state^year,
                                   data = gov_voting_dta))
# Column 3
summary(pwa_gov <- feols(pct_dem_gov ~  I(log(pc_pwa + 1)) | 
                           my_fips + state^year + urban_quintile^state^year + 
                           black_quintile^state^year + foreign_quintile^state^year + 
                           unemp_quintile^state^year,
                         data = gov_voting_dta))
# Column 4
summary(pwa_gov_incumbent <- feols(pct_dem_gov ~  I(log(pc_pwa + 1)) + I(log(pc_pwa + 1)):gop_seat | 
                                     my_fips + state^year + urban_quintile^state^year + 
                                     black_quintile^state^year + foreign_quintile^state^year + 
                                     unemp_quintile^state^year,
                                   data = gov_voting_dta))
# Column 5
summary(pwa_labor_gov <- feols(pct_dem_gov ~  I(log(pc_pwa_site_labor + 1)) | 
                                 my_fips + state^year + urban_quintile^state^year + 
                                 black_quintile^state^year + foreign_quintile^state^year + 
                                 unemp_quintile^state^year,
                               data = gov_voting_dta))
# Column 6
summary(pwa_labor_gov_incumbent <- feols(pct_dem_gov ~  I(log(pc_pwa_site_labor + 1)) + I(log(pc_pwa_site_labor + 1)):gop_seat | 
                                           my_fips + state^year + urban_quintile^state^year + 
                                           black_quintile^state^year + foreign_quintile^state^year + 
                                           unemp_quintile^state^year,
                                         data = gov_voting_dta))

## TABLE A13 ##
# Column 1
summary(wpa_south_1916_1944 <- feols(pct_dem_gov ~  I(log(pc_wpa + 1)) + I(log(pc_wpa + 1)):south | 
                                       my_fips + state^year + urban_quintile^state^year + 
                                       black_quintile^state^year + foreign_quintile^state^year + 
                                       unemp_quintile^state^year,
                                     data = gov_voting_dta))
# Column 2
summary(pwa_south_1916_1944 <- feols(pct_dem_gov ~  I(log(pc_pwa + 1)) + I(log(pc_pwa + 1)):south | 
                                       my_fips + state^year + urban_quintile^state^year + 
                                       black_quintile^state^year + foreign_quintile^state^year + 
                                       unemp_quintile^state^year,
                                     data = gov_voting_dta))
# Column 3
summary(pwa_labor_south_1916_1944 <- feols(pct_dem_gov ~  I(log(pc_pwa_site_labor + 1)) + I(log(pc_pwa_site_labor + 1)):south | 
                                             my_fips + state^year + urban_quintile^state^year + 
                                             black_quintile^state^year + foreign_quintile^state^year + 
                                             unemp_quintile^state^year,
                                           data = gov_voting_dta))


